package com.xg.demo.observermode;

import java.util.Observable;
import java.util.Observer;

/**
 * Created with IntelliJ IDEA.
 *
 * @author hans
 * @version 1.0
 * @date 2023/04/24/14:22
 * @description 观察者模式--定义具体观察者
 * 观察者模式--观察者(消息订阅者)
 * 实现 Observer 接口
 */
public class ObserverA implements Observer {

    private int myState;

    @Override
    public void update(Observable o, Object arg) {
        myState = ((ConcreteSubject)o).getState();
    }

    public int getMyState() {
        return myState;
    }

    public void setMyState(int myState) {
        this.myState = myState;
    }
}
